public class Solution1446 {
    public int maxPower(String s) {
        int max=0,count=0;
        char last=' ';
        for (char c:s.toCharArray()){
            if (c!=last){
                last=c;
                count=1;
            }else{
                count++;
            }
            max=Math.max(max,count);
        }
        return max;
    }

    public static void main(String[] args) {
        System.out.println(new Solution1446().maxPower("leetcode"));
    }
}
